﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Diagnostics;
using NLog;

namespace DcsGauges.Shared.DataStructures
{
    public class DcsCommand
    {
        #region Fields & Properties

        private static readonly     Logger              log             = LogManager.GetCurrentClassLogger();         

        public int      CommandId   { get; private set; }
        public int      DeviceId    { get; private set; }
        public string   Name        { get; private set; }

        #endregion

        #region Constructors

        public DcsCommand(DcsProperty property)
        {
            try
            {
                this.CommandId              = DcsCommands.GetCommandButtonId(property);
                this.DeviceId               = DcsDevices.GetDeviceId(property);
                this.Name                   = property.Name;
            }
            catch (Exception exc)
            {
                Debug.WriteLine(exc.ToString());
                log.Log(LogLevel.Error, exc.ToString());
                this.CommandId              = 0;
                this.DeviceId               = 0;
                this.Name                   = "Unknown";
            }
        }

        #endregion
    }
}
